<template>
  <view class="">
    <view class="info">
      <view class="msg">
        <view>订单编号</view>
        <view>{{ info.orderTradeId }}</view>
      </view>
      <view class="msg">
        <view>支付状态</view>

        <view>{{ allList[info.tradeStatus].name }}</view>
      </view>
      <view class="msg">
        <view>名称</view>
        <view>{{ info.tradeGoodsName }}</view>
      </view>
      <view class="msg">
        <view>下单时间</view>
        <view>{{ timestampToTime(info.tradeTime) }}</view>
      </view>
      <view class="msg">
        <view>金额</view>
        <view>￥{{ info.tradePrice }}</view>
      </view>
      <view
        class="msg"
        v-if="info.tradeStatus == 2 && info.writeOffStatus == 0"
      >
        <view>核销码</view>

        <view class="hxm" @click="hxmBtn(info.orderTradeId)"
          >点击查看核销码</view
        >
      </view>
    </view>
    <view class="info" v-for="(item, index) in info.activityPersonnelList">
      <view class="msg">
        <view>证件号</view>
        <view>{{ item.participantsIdCard }}</view>
      </view>
      <view class="msg">
        <view>手机号</view>

        <view>{{ item.participantsMobile }}</view>
      </view>
      <view class="msg">
        <view>名称</view>
        <view>{{ item.participantsName }}</view>
      </view>
    </view>
  </view>
</template>

<script>
import commonMixin from "@/mixin/commonMinxin";

export default {
  mixins: [commonMixin],
  data() {
    return {
      allList: [
        {
          tabId: 0,
          name: "待支付",
        },
        {
          tabId: 1,
          name: "待发货",
        },
        {
          tabId: 2,
          name: "待收货",
        },
        {
          tabId: 3,
          name: "已取消",
        },
        {
          tabId: 4,
          name: "已完成",
        },
      ],
      id: "",
      info: {},
    };
  },
  onLoad(e) {
    this.id = e.id;
    this.init();
  },
  methods: {
    hxmBtn(id) {
      uni.navigateTo({
        url: "/pages/hotspot/orderDetail?orderNo=" + id,
      });
    },
    timestampToTime(timestamp) {
      let date = new Date(timestamp);
      let Y = date.getFullYear() + "-";
      let M =
        (date.getMonth() + 1 < 10
          ? "0" + (date.getMonth() + 1)
          : date.getMonth() + 1) + "-";
      let D =
        (date.getDate() < 10 ? "0" + date.getDate() : date.getDate()) + " ";
      let h =
        (date.getHours() < 10 ? "0" + date.getHours() : date.getHours()) + ":";
      let m =
        (date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes()) +
        ":";
      let s =
        date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
      return Y + M + D + h + m + s;
    },
    init() {
      uni.app.post(
        "/activity/order/details",
        {
          id: this.id,
        },
        "json",
        "",
        (res) => {
          console.log(res, "res");
          if (res.code == 2000) {
            this.info = res.data;
            // this.BasicData = res.data.records[0]
            // this.BasicData.author=this.BasicData.mediaList[0]
          }
        },
      );
    },
  },
};
</script>

<style lang="scss" scoped>
.hxm {
  color: #3096ea;
}
.info {
  background: #fff;
  margin-top: 30rpx;
}
.msg {
  display: flex;
  justify-content: space-between;
  padding: 30rpx;
  border-bottom: 2rpx solid #f5f5f5;
  // line-height: 80rpx;
}
</style>
